package com.moshang.exportsql.model.enums;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public enum AttributeInfoCategoryEnum {
    /**
     * 枚举
     */
    PERMANENT("永久", "PERMANENT"),
    RUNTIME("动态", "RUNTIME"),
    VOID("无", "VOID");
    private String code;
    private String desc;

    AttributeInfoCategoryEnum(String desc, String code) {
        this.desc = desc;
        this.code = code;
    }

    public String desc() {
        return this.desc;
    }

    public String code() {
        return code;
    }

    public static AttributeInfoCategoryEnum getEnumByDesc(String desc) {
        for (AttributeInfoCategoryEnum e : AttributeInfoCategoryEnum.values()) {
            if (StrUtil.equals(desc, e.desc())) {
                return e;
            }
        }
        return null;
    }
}
